package com.cwd.arm.common.dto.session;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

/**
 * Created by yan on 21-12-7.
 */
@Data
public class UserDto implements UserDetails {

    private Long id;

    private String username;

    private String realName;

    private String phone;

    private String password;

    private String mask;

    private boolean enabled;

    private List<AuthDto> authDtoList;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return authDtoList;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return enabled;
    }

}
